package com.qianfeng.openapi.web.master.quartz.task;

import org.springframework.stereotype.Component;

import java.io.IOException;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/11/27
 * @Time: 下午5:43
 */
@Component("backUpDb")//<bean id="backUpDb" class="">
public class BackupDb {

    public   void  backUp(){
        try {
            //创建Runtime类
            Runtime runtime = Runtime.getRuntime();
            //执行备份数据库的命令 javac  java
            //c://file program/mysql/bin/
            runtime.exec("mysqldump -uroot -padmin ttshop -r /Users/liliting/Desktop/sql/"+System.currentTimeMillis()+".sql");
            System.out.println("备份成功！");
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
